package com.linghu.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;

@Configuration
public class LangChain4jConfiguration {
    /*
     * The following components will be automatically wired into the AI Service if
     * available in the application context:
     *
     * ChatLanguageModel
     * StreamingChatLanguageModel
     * ChatMemory
     * ChatMemoryProvider
     * ContentRetriever
     * RetrievalAugmentor
     */
    @Bean
    ChatMemory chatMemory() {
        return MessageWindowChatMemory.withMaxMessages(100);
    }
}